export function queryLoginUser() {
    return new Promise((resolve) => {
        axios.post('/user/getInfo').then(rs => {
            resolve(rs.data.data);
        });
    })
}

export function updateUserInfo(user) {
    return new Promise(resolve => {
        axios.post('/user/updateUserInfo', user, {
            headers: {
                'content-type': 'application/json' //@requestBody,不能用qs
            }
        }).then(resp => {
            resolve(resp.data);
        }).catch(() => resolve({code: 204, message: '服务器连接失败'}));
    });
}

export function queryUsers() {
    return new Promise(resolve => {
        axios.post('/user/queryUsers').then(resp => {
            resolve(resp.data);
        });
    });
}

export function login(form) {
    return new Promise(resolve => {
        axios.post('/user/login', form, {
            headers: {
                'content-type': 'application/json' //@requestBody,不能用qs
            }
        }).then(resp => {
            resolve(resp.data);
        }).catch(() => {
            resolve({code: 204, message: '服务器连接失败'})
        });
    });

}